package com.xwd.web.student;

import com.xwd.service.StudentService;
import com.xwd.service.impl.StudentServiceImpl;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;
import java.io.PrintWriter;

@WebServlet("/deleteStudent")
public class DeleteStudentServlet extends HttpServlet {
    @Override
    protected void service(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
        //接受参数
        String stuId = req.getParameter("stuId");
        //调用Service方法
        StudentService service = new StudentServiceImpl();
        int i = service.deleteStudent(Integer.parseInt(stuId));

        req.getRequestDispatcher("/getStudetList").forward(req,resp);
    }
}
